package com.sali.b_design_pattern.c_factory_method_pattern.lesson_02;

import com.sali.b_design_pattern.c_factory_method_pattern.lesson_02.factory.BlockFactory;
import com.sali.b_design_pattern.c_factory_method_pattern.lesson_02.service.Block;

import java.util.ArrayList;
import java.util.List;

// 积⽊⼯⼚系统
public class BlockFactorySystem {

    private List<Block> blocks = new ArrayList<>();

    public void produceBlocks(BlockFactory factory, int quantity) {
        for (int i = 0; i < quantity; i++) {
            Block block = factory.createBlock();
            blocks.add(block);
            block.produce();
        }
    }

    public List<Block> getBlocks() {
        return blocks;
    }

}
